import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PaySplitVO, PaySplitForm, PaySplitQuery } from '@/api/device/paySplit/types';

/**
 * 查询微信分账列表
 * @param query
 * @returns {*}
 */

export const listPaySplit = (query?: PaySplitQuery): AxiosPromise<PaySplitVO[]> => {
  return request({
    url: '/device/paySplit/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询微信分账详细
 * @param paySplitId
 */
export const getPaySplit = (paySplitId: string | number): AxiosPromise<PaySplitVO> => {
  return request({
    url: '/device/paySplit/' + paySplitId,
    method: 'get'
  });
};

/**
 * 新增微信分账
 * @param data
 */
export const addPaySplit = (data: PaySplitForm) => {
  return request({
    url: '/device/paySplit',
    method: 'post',
    data: data
  });
};

/**
 * 修改微信分账
 * @param data
 */
export const updatePaySplit = (data: PaySplitForm) => {
  return request({
    url: '/device/paySplit',
    method: 'put',
    data: data
  });
};

/**
 * 删除微信分账
 * @param paySplitId
 */
export const delPaySplit = (paySplitId: string | number | Array<string | number>) => {
  return request({
    url: '/device/paySplit/' + paySplitId,
    method: 'delete'
  });
};
